//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    city:"",
    tem:"",
    wea:"",
    tem2:"",
    tem1:""
  },
  onLoad: function (options) {
    // 页面创建时执行
    wx.request({
      url: 'https://tianqiapi.com/api',
      data:{
        appid:"69943197",
        appsecret:"GbZjcD55",
        version:"v6"
      },
      success :res =>{
        console.log("接收请求数据成功");
        console.log(res)
        this.getNow(res)
      }
    })
  },
  getNow(res){
    var data = res.data
    console.log(data)
    this.setData({
      city: data.city,
      tem: data.tem,
      wea: data.wea,
      tem2:data.tem2,
      tem1:data.tem1,
      air_level:data.air_level,
      win:data.win,
      humidity:data.humidity,
      visibility:data.visibility,
      pressure:data.pressure
    })
  }
})